﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hi_Baidu.ProcessModel;

namespace Hi_Baidu.Timer
{
    class ModifyProdTimeOutEvent : TimeOutEvent
    {
        private byte[] username;
        private byte[] NewProd;

        public ModifyProdTimeOutEvent(byte[] username, byte[] NewProd, String Key, int Interval, int TryCount) 
            : base(Key, Interval, TryCount)
        {
            this.username = username;
            this.NewProd = NewProd;
            this.OnTryFull += new EventHandler<EventArgs>(ModifyProdTimeOutEvent_OnTryFull);
            this.OnTick += new EventHandler<EventArgs>(ModifyProdTimeOutEvent_OnTick);
        }

        void ModifyProdTimeOutEvent_OnTick(object sender, EventArgs e)
        {
            //重试修改
            UpdateProcessModel.ModifyProd(this.username, this.NewProd);
        }

        void ModifyProdTimeOutEvent_OnTryFull(object sender, EventArgs e)
        {
            System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new PUBLIC_DELEGATE(Globle.ShowWindow));
        }
    }
}
